<template>
  <div class="order">
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="全部订单" name="first" :key="'first'">
          <AllOrder v-if="isFirst"></AllOrder>
        </el-tab-pane>
        <el-tab-pane lazy label="未发货" name="second" :key="'second'">
          <UnshipOrder v-if="isSecond"></UnshipOrder>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import AllOrder from "@/components/AllOrder.vue";
import UnshipOrder from "@/components/UnshipOrder.vue";

export default {
  data() {
    return {
      activeName: 'first',
      isFirst: true,
      isSecond: false
    };
  },
  components: {
    UnshipOrder,
    AllOrder
  },
  methods: {
     handleClick(tab) {
      if (tab.name === 'first') {
        this.isFirst = true
        this.isSecond = false
      } else if (tab.name === 'second') {
        this.isFirst = false
        this.isSecond = true
      }
    }
  }
};
</script>

<style scoped>
</style>